import request from '@/utils/request'

// 查询时间段列表
export function listTime(query) {
  return request({
    url: '/lxy/time/list',
    method: 'get',
    params: query
  })
}

// 查询时间段详细
export function getTime(id) {
  return request({
    url: '/lxy/time/' + id,
    method: 'get'
  })
}

// 新增时间段
export function addTime(data) {
  return request({
    url: '/lxy/time',
    method: 'post',
    data: data
  })
}

// 修改时间段
export function updateTime(data) {
  return request({
    url: '/lxy/time',
    method: 'put',
    data: data
  })
}

// 删除时间段
export function delTime(id) {
  return request({
    url: '/lxy/time/' + id,
    method: 'delete'
  })
}

// 查询未成行时间段列表
export function listNotCanGoTime(projectId,query) {
  return request({
    url: '/lxy/time/list/notcango/'+projectId,
    method: 'get',
    params: query
  })
}

// 查询成行时间段列表
export function listCanGoTime(projectId,query) {
  return request({
    url: '/lxy/time/list/cango/'+projectId,
    method: 'get',
    params: query
  })
}

export function setCanGo(id) {
  return request({
    url: '/lxy/time/cango/' + id,
    method: 'put'
  })
}

export function setNotCanGo(id) {
  return request({
    url: '/lxy/time/notcango/' + id,
    method: 'put'
  })
}

//清空未成形时间段，并释放报名人员
export function removeNotcango(projectId) {
  return request({
    url: '/lxy/time/removeNotcango/' + projectId,
    method: 'delete'
  })
}
// 开启补报
export function startReselect(reselectStart, reselectEnd, id) {
  const data = {
    reselectStart: reselectStart,
    reselectEnd: reselectEnd
  };
  return request({
    url: '/lxy/time/reselect/' + id,
    method: 'put',
    params: data
  });
}
